package com.hr.controller.admin;

import com.hr.domain.query.PaymentRecordPageParams;
import com.hr.domain.query.PaymentRecordPageResult;
import com.hr.service.PaymentRecordService;
import com.hr.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/admin/paymentRecord")
@AllArgsConstructor
@Tag(name = "后台支付记录信息管理")
public class PaymentRecordController {

    private final PaymentRecordService paymentRecordService;

    /**
     * 分页获取支付记录列表
     * @param queryParams
     * @return
     */
    @GetMapping("/page")
    @Operation(summary = "分页获取支付记录列表")
    public Result getPaymentRecordPageList(PaymentRecordPageParams queryParams) {
        log.info("分页获取支付记录列表，请求参数: {}", queryParams);
        PaymentRecordPageResult result = paymentRecordService.getPaymentRecordPageList(queryParams);
        return Result.success(result);

    }

    @PutMapping("/update")
    @Operation(summary = "更新支付记录状态")
    public Result updatePaymentRecordStatus(@RequestParam("id") Long id,
                                            @RequestParam("status") Integer status) {
        log.info("更新支付记录状态");
        String msg = paymentRecordService.updatePaymentRecordStatus(id, status);
        return Result.success(msg);
    }

}
